#include<stdio.h>
int main() {
    int i = 0;
    int left = 0;
    int sum = 0;
    int a[12];
    int b = 0;
    int save = 0;
    for (int i = 0; i < 12; i++)
    {
        scanf("%d", &a[i]);
        if (a[i] > 350)
            exit(0);
    }
    for (int i = 0; i < 12; i++)
    {
        left += 300;
        left -= a[i];
        if (left < 0)
        {
            printf("%d", -(i + 1));
            exit(0);
        }
        if (left >= 100)
        {
            b = left / 100;
            save += b * 100;
            left %= 100;
        }
    }
    sum = left + (save * 1.2);
    printf("%d", sum);
	return 0;
}